import { defineStore } from 'pinia'

const useCountStore = defineStore('count', {
  state() {
    return {
      num: 6,
      address: '杭州',
      work: 'IT',
    }
  },
  actions: {
    increment(val: number) {
      console.log('store中的this：', this) // 可以获取到
      // console.log('store中的state是否存在：',state)
      this.num += val
    },
  },
  getters: {
    bigNum: (state) => state.num * 5,
    bigNum2(state) {
      console.log('getter中可以获取this吗：', this === state) // true
      return this.num * 10
    },
  },
})

export default useCountStore
